import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '@/views/layout';

Vue.use(VueRouter);

export const constantRouterMap = [{
		path: '/login',
		component: () => import('@/views/login'),
		hidden: true
	}, {
		path: '/error',
		hidden: true,
		component: () => import('@/views/error'),
	}
];

export default new VueRouter({
	scrollBehavior: () => ({
		y: 0
	}),
	fallback: false,
	routes: constantRouterMap
});


export const asyncRouterMap = [{
	path: '',
	component: Layout,
	alwaysShow: true,
	name: 'YHselect', //标识
	meta: {
		title: '选举管理',
		icon: 'cogs'
	},
	children: [{
		path: 'YHselect',
		alwaysShow: false,
		component: () => import('@/views/select/basic'),
		meta: {
			title: '基本详情',
			name: 'YHselectBasic',
			icon: 'comments'
		},
		name: 'YHselectBasic' //标识
	}]
}, {
	path: '',
	component: Layout,
	alwaysShow: true,
	name: 'YHvote', //标识
	meta: {
		title: '投票管理',
		icon: 'sticky-note'
	},
	children: [{
			path: '',
			component: () => import('@/views/vote'),
			meta: {
				title: '投票管理1',
				icon: 'sticky-note'
			},
			name: 'YHvoteIndex1', //标识
			alwaysShow: true,
			children:[{
				path: 'YHvoteIndex-1',
				component: () => import('@/views/vote'),
				meta:{
					title: '投票管理11',
					name: 'YHvoteIndex11',
				},
				// name: 'qYHvoteIndex11', //标识
			},{
				path: 'YHvoteIndex-3',
				component: () => import('@/views/vote'),
				meta:{
					title: '投票管理22',
					name: 'YHvoteIndex12',
				},
				// name: 'qYHvoteIndex22', //标识
			}]
		},{
			path: 'YHvoteIndex2',
			component: () => import('@/views/vote'),
			meta: {
				title: '投票管理2',
				icon: 'sticky-note'
			},
			name: 'YHvoteIndex2', //标识
			alwaysShow: false,
		}]
}];
